FROM daocloud.io/library/java:openjdk-8u40-jre

ENV CATALINA_HOME /usr/local/tomcat
ENV PATH $CATALINA_HOME/bin:$PATH
RUN mkdir -p "$CATALINA_HOME"
WORKDIR $CATALINA_HOME

ADD ../tomcat.zip ./
ADD ../docker-start.sh bin
RUN ls && cd bin && ls && chmod 777 *.sh

ENV APP_BASE_URL="http://192.168.1.144:8081/nexus/content/repositories/releases"
ENV APP_NAME=pmsuite-file-provider
ENV APP_VERSION=4.5
RUN mkdir -p webapps/ROOT && cd webapps/ROOT \
    && wget -q "$APP_BASE_URL/cn/pinming/$APP_NAME/$APP_VERSION/$APP_NAME-$APP_VERSION.war" \
    && unzip $APP_NAME-$APP_VERSION.war \
    && rm -rf $APP_NAME-$APP_VERSION.war

RUN mkdir -p /data/uploads

EXPOSE 8080
EXPOSE 20881
CMD ["docker-start.sh", "run"]